package com.itheima.demo;

import java.io.*;

public class CopyDemo {
    public static void main(String[] args) throws Exception {
        FileInputStream fileInput = new FileInputStream(new File("Day11_File&IO\\a.txt"));
        FileOutputStream fileOutput = new FileOutputStream(new File("Day11_File&IO\\c.txt"));
        byte[] bytes = new byte[4];
        int len;
        while ((len = fileInput.read(bytes)) != -1){
            fileOutput.write(bytes);
        }
        fileInput.close();
        fileOutput.close();
    }

    private static void method1() throws IOException {
        FileInputStream fileInput = new FileInputStream(new File("Day11_File&IO\\a.txt"));
        FileOutputStream fileOutput = new FileOutputStream(new File("Day11_File&IO\\c.txt"));
        int b;
        while ((b = fileInput.read()) != -1){
            fileOutput.write(b);
        }
        fileInput.close();
        fileOutput.close();
    }
}
